package io.renren.modules.combat.controller;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.renren.modules.combat.entity.TFightDictionaryEntity;
import io.renren.modules.combat.service.TFightDictionaryService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2019-08-05 13:21:51
 */
@RestController
@RequestMapping("/tfightdictionary")
public class TFightDictionaryController {
    @Autowired
    private TFightDictionaryService tFightDictionaryService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("generator:tfightdictionary:list")
    public R list(@RequestBody Map<String, Object> params){
        PageUtils page = tFightDictionaryService.queryPage(params);
        return R.ok().put("page", page);
    }

    /**
     * 统计
     */
    @RequestMapping("/getTFightDictionaryEntity")
   // @RequiresPermissions("generator:tfightdictionary:getTFightDictionary")
    public R getTFightDictionaryEntity(){
        List<TFightDictionaryEntity> list=tFightDictionaryService.getTFightDictionaryEntity();
        return R.ok().put("list", list);
    }

    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("generator:tfightdictionary:info")
    public R info(@PathVariable("id") Integer id){
		TFightDictionaryEntity tFightDictionary = tFightDictionaryService.getById(id);

        return R.ok().put("tFightDictionary", tFightDictionary);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
   // @RequiresPermissions("generator:tfightdictionary:save")
    public R save(@RequestBody TFightDictionaryEntity tFightDictionary){
		tFightDictionaryService.save(tFightDictionary);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("generator:tfightdictionary:update")
    public R update(@RequestBody TFightDictionaryEntity tFightDictionary){
		tFightDictionaryService.updateById(tFightDictionary);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("generator:tfightdictionary:delete")
    public R delete(@RequestBody Integer[] ids){
		tFightDictionaryService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
